$(function () {
    initData();
    var chkData = {
        labelField: 'name',
        valueField: 'id',
        checkedValue: [1, 2],
        size: 3,  // 没行显示几个
        labelWidth: '180px',  // 字体的宽度
        data: [
            {id: 1, name: '上海交易数据', attrName: 'data-id', attrVal: '1'},
            {id: 2, name: '深圳交易数据', attrName: 'data-name', attrVal: '2'},
            {id: 3, name: '中金所交易数据', attrName: 'data-name', attrVal: '3'},
            {id: 4, name: '固定收益平台数据', attrName: 'data-name', attrVal: '3'},
            {id: 5, name: '转融通相关数据', attrName: 'data-name', attrVal: '3'}
        ],
        onChangeExt: function (obj, options) {
            console.log(obj)
        },
        onLoadSuccess: function (obj, options) {
            console.log(obj)
        }
    };
    $('#panelMain').checkboxExt(chkData);
})

// 初始化加载下拉框的值
function initData() {
    $.ajax({
            type: "post",
            url: dataway + "/dataway/init",
            success: function (data) {
                if (successcode != data.code) {
                    return errorHandle(data);
                }
                var lsetlists = data.data.lsetlists;
                if (!isNull(lsetlists)) {
                    $("#accountId").combotree("loadData", lsetlists);
                }
            }, error: function (data) {
                $.messager.progress('close');
                $.messager.alert('系统提示', "系统异常，请稍后重试！", 'error');
            }
        }
    );
}


//读取文件
function readExcel(fileName) {
    $('#subXls').form('submit', {
        url: dataway + "/dataway/upload",
        onSubmit: function (param) {
            $.messager.progress({text: '正在处理中...'});
        }, success: function (data) {
            $.messager.progress('close');
            data = JSON.parse(data);
            if (successcode != data.code) {
                $("#readXls").val("");
                return errorHandle(data);
            }
            $.messager.show({title: '系统提示', msg: data.message});
        }, error: function (data) {
            $("#readXls").val("");
            $.messager.progress('close');
            $.messager.alert('系统提示', "系统异常，请稍后重试！", 'error');
        }
    });
}
